#include <stdio.h>
#include <stdlib.h>
#include <string.h>

//输入一个整数将每一位上的奇数放在一个新整数中，高位放在高位，地位在低位。
int fun(int number) {
    int new_number = 0;
    int temp = number;
    int bit = 0;
    //先判断是几位数
    int length = 1;
    int len = 0;
    while (1) {
        temp = temp / 10;
        if (temp == 0) {
            break;
        }
        length++;
    }
    len = length;
    while(length) {
        bit = number % 10;
        number = number / 10;
        if(bit % 2 != 0) {
            new_number = new_number * 10 + bit;
        }
        length--;
    }

    int result = 0;
    //最后再逆序重新组成这个数
    while (len) {
        bit = new_number % 10;
        if (bit == 0) {
            break;
        }
        new_number = new_number / 10;
        result = result * 10 + bit;
        len--;
    }
    return result;
}

int main(int argc, const char* argv[])
{
    int number = 0;
    printf("请输入一个数：\n");
    scanf("%d", &number);
    int res = fun(number);
    printf("新组成的数是%d\n", res);

    return 0;

}


